const express = require("express");
const path = require('path');
const port = 3001

const app = express();

// app.use(express.static('public'));
app.use('/', express.static('public'));

app.get('/test', (req, res) => {
    res.send('<h1>Hello World!</h1>');
})
app.post('/test', (req, res) => {
    console.log(req);
    req.on('data', (chunk) => {
        console.log(chunk.toString());
    });
    res.json({ name: 'test', age: 20 });
})
app.listen(port, () => {
    console.log(`server is running at http://127.0.0.1:${port}`);
})